package thread;

/*
 * @author zzr
 * @date: 2025/04/14  11:38
 * @description:
 */
class MyThread2 extends Thread {
    @Override
    public void run() {
        while (true) {
            System.out.println("hello MyThread2");
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
        }
    }
}
public class Thread2 {
    public static void main(String[] args) throws InterruptedException {
        Thread t = new MyThread2();
        t.start();
        while (true) {
            System.out.println("hello mainThread");
            Thread.sleep(1000);
        }
    }
}
